<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css" />
    <link rel="stylesheet" href="atca_calibrators.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js">
      djConfig={
      parseOnLoad: true,
      isDebug: true,
      baseUrl: "./",
      };
    </script>
    <script type="text/javascript" src="sprintf-0.7-beta1.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
    <script src="/js/highcharts.js" type="text/javascript"></script>
    <script src="atca_calibrators.js"></script>
    <script language="javascript" type="text/javascript">
      function init() {
      
        // the node we use as the top level
        var DOMnode = dojo.byId('contentDiv');

        getOptions();
      
        if (!options.source) {
          DOMnode.appendChild(dojo.create('div', {
            innerHTML: 'Calibrator not specified' }));
          return;
        }
        if ((!options.band) && (!options.frequency)) {
          DOMnode.appendChild(dojo.create('div', {
            innerHTML: 'Band/frequency not specified' }));
          return;
        }

        var pageTitle = '';
        var actionContent;
        var routine;
        if (options.band) {
          pageTitle = 'Visibility plot for ' + options.source +
            ' at ' + options.band;
          actionContent = { action: 'visplots',
            source: options.source, band: options.band };
          routine = drawVisPlotPage;
        } else if (options.frequency) {
          pageTitle = 'Flux history plot for ' +
            options.source + ' at ' + options.frequency +
            ' MHz';
          actionContent = { action: 'fluxhistory',
            source: options.source, frequency: options.frequency };
          // set up the plot's global options
          Highcharts.setOptions({ global: { useUTC: true },
            tooltip: { formatter: function() {
              var s = ['<span style="font-size: 10px">',
	        Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x),
	        '</span><br/>',
                '<span style="color:' + this.series.color + '">',
	        this.y, ' Jy', '</span>'];
	      return s.join('');
          }}});

          routine = drawFluxHistoryPage;
        }
      
        var sourceHeader = dojo.create('div', {
	  innerHTML: pageTitle,
            'class': 'sourceHeader' });
        DOMnode.appendChild(sourceHeader);
      
        document.title += ' - ' + pageTitle;
      
        // get some information from the database
        dojo.xhrPost({
          url: '/cgi-bin/Calibrators/new/calinfo_json.pl' ,
          sync: false,
          content: actionContent,
          handleAs: 'json',
          load: routine,
          error: function(error, ioargs){
            alert(error);
          }
        });
      
      }
      
      dojo.addOnLoad(init);
    </script>
    <title>ATCA Calibrators</title>
  </head>
  <body class="claro">
    <div class="topbacking">
      <div class="csirologo">
	<a href="http://www.csiro.au/">
	  <img src="csiro50spaced.gif" /></a>
      </div>
      <div class="main">
	<span class="cass">CSIRO Astronomy and Space Science</span>
	<br />
	<span class="pagetitle">ATCA Calibrator Database</span>
      </div>
      <div class="csiroend"><img src="green50.gif" /></div>
    </div>
    <div class="content" id="contentDiv">

    </div>
  </body>
</html>
